import request from '/@/utils/request';

/**
 * 
 * @method getPublicKey 获取公钥
 * @method login 登录
 * 
 */
export function loginApi() {
	return {
		getPublicKey: () => {
			return request({
				url: '/api/login/publicKey',
				method: 'POST'
			}).then(res =>{
				if (res.data.code === "000000") {
					return Promise.resolve(res.data);
				} else {
					return Promise.reject(res.data);
				}
			});
		},
		login: (params: object) => {
			return request({
				url: '/api/login/index',
				method: 'POST',
				data: params
			}).then(res =>{
				if (res.data.code === "000000") {
					return Promise.resolve(res.data);
				} else {
					return Promise.reject(res.data);
				}
			});;
		}
	};
}
